package com.miki.road.controller;

import com.github.pagehelper.PageInfo;
import com.miki.road.entity.Device;
import com.miki.road.sevice.IDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * author: Leeon
 * 2020/3/31
 * road
 */
@RestController
public class DeviceController {

    @Autowired
    private IDeviceService deviceService;

    @RequestMapping("/getAll")
    public List<Device> getAll(){
        return deviceService.getAll();
    }

    @RequestMapping("/page")
    public PageInfo<Device> getDevices(@RequestParam(defaultValue = "1") Integer pageNum,
                                       @RequestParam(defaultValue = "10") Integer pageSize){
        return deviceService.page(pageNum,pageSize);
    }
}
